package GameState.Projectiles;

import java.awt.Point;

import GameState.GamePiece;
import GameState.GamePieceType;

public class CannonBall extends GamePiece{


	/**
	 * 
	 */
	private static final long serialVersionUID = -6345032715169614657L;
//	private final  static int GRAPHICS_WIDTH  = 10; 
//	private final static int GRAPHICS_HEIGHT = 10;
	private final static int MAX_CANNONBALL_LIFE = 50;
//	private int mBallRadius = 2;/
	
	//Top left handPositiong of the ships
	private int mDirection; 
	private int mXposition;
	private int mYposition;
	
	
	private int mSpeed;


	public CannonBall(final int direction, final  int xPosition, final  int yPosition){

		this.mDirection = direction;
		this.mXposition = xPosition;
		this.mYposition = yPosition;
		mSpeed = MAX_CANNONBALL_LIFE;

	}

	public boolean shouldDelete(){

		return --mSpeed <= 0;

	}

	/**
	 * 
	 */
	public void move() {
		
		mYposition -= (int) 10 * Math.cos(Math.toRadians(mDirection));				
		mXposition +=  (int) 10 * Math.sin(Math.toRadians(mDirection));

	}

	
	public Point getPosition() {

		return new Point(mXposition, mYposition);
	}

	@Override
	public GamePieceType getRenderType() {
		// TODO Auto-generated method stub
		return GamePieceType.CANNON_BALL;
	}

	@Override
	public int getRotation() {

		return 0;
	}
	
}
